﻿using UnityEngine;
using System.Collections;
using System;

public enum ISkillTriggerExcuteType
{
    Stet_Skill_Start,
    Stet_Skill_Ing,
    Stet_Skill_End
}

/// <summary>
/// 执行每个技能的具体效果
/// </summary>
public interface ISkillTrigger
{
    /// <summary>
    /// 对技能实力初始化
    /// </summary>
    /// <param name="args"></param>
    void Init(string args); //PS:C#的接口都是public的
    /// <summary>
    /// 重置技能实例信息
    /// </summary>
    void Reset();
    /// <summary>
    /// 克隆一个技能实力
    /// </summary>
    /// <returns></returns>
    ISkillTrigger Clone();

    /// <summary>
    /// 执行技能效果
    /// </summary>
    /// <param name="instance">存储这个技能的一些信息用来 技能的一些判断等</param>
    /// <param name="curtime">当前帧时间，做一些判断</param>
    /// <returns></returns>
    bool Execute(ISkillCore instance, float curtime);
    /// <summary>
    /// 获取开始执行的时间
    /// </summary>
    /// <returns></returns>
    float GetStartTime();
    /// <summary>
    /// 是否执行了
    /// </summary>
    /// <returns></returns>
    bool IsExecuted();
    /// <summary>
    /// trigger当前的执行状态
    /// </summary>
    /// <returns></returns>
    ISkillTriggerExcuteType GetExecuteType();
    /// <summary>
    /// Trigger的类型
    /// </summary>
    /// <returns></returns>
    string GetTypeName();
}

/// <summary>
/// 对技能的抽象
/// </summary>
public abstract class AbstructSkillTrigger : ISkillTrigger
{
    protected float m_fStartTime = 0;
    protected bool m_bIsExecuted = false;
    protected string m_TypeName;
    protected ISkillTriggerExcuteType m_ExecuteType = ISkillTriggerExcuteType.Stet_Skill_Start;

    public abstract ISkillTrigger Clone();
    public abstract bool Execute(ISkillCore instance, float curtime);

    public abstract ISkillTriggerExcuteType GetExecuteType();

    public abstract float GetStartTime();
    public abstract string GetTypeName();

    public abstract void Init(string args);

    public abstract bool IsExecuted();
    public abstract void Reset();      
    
}